## Replication files for "Ministerial Autonomy, Paliamentary Scrutiny and Government reform Output in Parliamentary Democracies
## Authors: Hanna Bäck, Wolfgang C. Müller, Mariyana Angelova, Daniel Strobl
## Corresponding author: Mariyana Angelova - angelova@ceu.edu
## 15.01.2021

## This script creates figure 3: Government Alternation and Number of Important Reforms


## set working directory
setwd("~/Desktop/Replication files")


## Plot upper part of figure: previous government
pdf(file="figure3.pdf",width=9,height=6,paper='special') 
plot(1, type="n", xlab="", ylab="", xlim=c(-3, 25), ylim=c(-2, 20), las=1, asp=1, xaxt = 'n', yaxt = 'n', bty="n" )
x<-2
y<-14
text(x-9.2,y, labels="Previous \ngovernment", cex=1.4, adj=0.3)

dist<-20

## left right line
segments(x,y,x+dist,y)
segments(x,y,x,y+0.3)
segments(x,y,x,y-0.3)
segments(x+dist,y,x+dist,y+0.3)
segments(x+dist,y,x+dist,y-0.3)

## label extremes
text(x-2,y, labels="Left", cex=1.4)
text(x+dist+2.5,y, labels="Right", cex=1.4)

## plot vertical lines which go through the governmetn positions
segments(x+pg1.x,y-10.5,x+pg1.x,y,  col="gray80", lty=3, lwd=2)
segments(x+pg2.x,y-10.5,x+pg2.x,y,  col="gray80", lty=3, lwd=2)
segments(x+cg.x,y-10.5,x+cg.x,y,  col="black", lty=2, lwd=2)

# define positions of governments on the x axis
pg1.x<-7
pg2.x<-16
cg.x<-5
## pg2 position: previous government 2 position
points(x+pg2.x,y, pch=19, cex=1)
text(x+pg2.x,y+1.5, labels="PG2", cex=1.4)

## pg1 position: previous government 1 position
points(x+pg1.x,y, pch=19, cex=1, col="gray50")
text(x+pg1.x,y+1.5, labels="PG1", cex=1.4, col="gray50")


##===============================================================
## plot current government
##===============================================================
y<-3.5
col="black"
text(x-9.2,y, labels="Current \n government", cex=1.4,adj=0.3, col=col)
segments(x,y,x+dist,y)
segments(x,y,x,y+0.3)
segments(x,y,x,y-0.3)
segments(x+dist,y,x+dist,y+0.3)
segments(x+dist,y,x+dist,y-0.3)
text(x-2,y, labels="Left", cex=1.4)
text(x+dist+2.5,y, labels="Right", cex=1.4)


## plot current government, distance to pg1
points(x+cg.x,y, pch=19, cex=1, col=col)
text(x+cg.x,y-1.5, labels="CG", cex=1.4, col="black")


## plot arrows between the current governemtn and pg1, add text with low number of reforms
y2<-10
arrows(x+pg1.x,y2,x+cg.x,y2, length=0.1, col="gray50")
arrows(x+cg.x,y2,x+pg1.x,y2, length=0.1, col="gray50")
text(x+dist,y2, labels="Low N of Reforms", cex=1.2,adj=0, col="gray50")

 ## plot arrow between current government and  pg2, add text with high number of reforms
dist.y<-2
 arrows(x+cg.x,y2-dist.y,x+pg2.x,y2-dist.y, length=0.1, col="black")
 arrows(x+pg2.x,y2-dist.y,x+cg.x,y2-dist.y, length=0.1, col="black")
 text(x+dist,y2-dist.y, labels="High N of Reforms", cex=1.2,adj=0)
 

dev.off()

